# !/usr/bin/env python
# encoding: utf-8


"""
  @author: gaogao
  @file: infoDialog.py
  @time: 2022/11/2 11:27
  @desc:
"""
from PyQt5.QtWidgets import QMessageBox


# 自动关闭的dialog
def auto_close_dialog(parent, tips):
    info_box = QMessageBox(parent)
    info_box.setIcon(QMessageBox.Information)
    info_box.setText(tips)
    info_box.setWindowTitle("提示")
    info_box.setStandardButtons(QMessageBox.Ok)
    info_box.button(QMessageBox.Ok).animateClick(1 * 1000)  # 1秒自动关闭
    info_box.exec_()


# 信息框
def show_info(parent, content):
    QMessageBox.information(parent, "提示", content)


# 警告框
def show_critical(parent, content):
    QMessageBox.critical(parent, "警告", content)


# 询问框
def show_ask(parent, content):
    return QMessageBox.question(parent, "提示", content)
